﻿@model RXY_Mall.Application.Order.Dto.GetOrderOutput

@section CSS{
    <link href="~/Content/css/layerui/layui.css" rel="stylesheet" />
}
<!-- Content Wrapper. Contains page content -->
<div class="content-wrapper">
    <section class="content-header">
        <h1>
            订单
            <small>详情</small>
        </h1>
        <ol class="breadcrumb">
            <li><a href="#"><i class="fa fa-dashboard"></i> 首页</a></li>
            <li><a href="#">销售管理</a></li>
            <li><a href="/Order/GoodsOrders">订单列表</a></li>
            <li class="active">订单详情</li>
        </ol>
    </section>
    <section class="content">
        <div class="row">
            <div class="col-md-12">
                <div class="box box-primary">
                    <div class="box-header with-border">
                        <h3 class="box-title">订单信息</h3>
                    </div>
                    <!-- /.box-header -->
                    <div class="box-body">
                        <div class="row">
                            <div class="col-md-12 form-group">
                                <label>交易状态:</label>
                                <label style="color:red; margin-right:10px;">@Model.order_status</label>
                                @*@if (Model.order_status == "待发货")
                                {
                                    <button type="button" onclick="SendShip(@Model.order_id)" class="btn bg-orange btn-flat margin" data-toggle="modal" data-target="#modal-default">发货</button>
                                    <span style="margin-left:10px;">请在<span style="color:red;">@(((DateTime)Model.add_time).AddDays(2))</span>前发货</span>
                                }*@
                            </div>
                            <div class="col-md-4 form-group">
                                <label>订单号:</label>
                                <span>@Model.order_no</span>
                            </div>
                            <div class="col-md-4 form-group">
                                <label>下单时间:</label>
                                <span>@Model.add_time</span>
                            </div>
                        </div>
                        <table class="table table-bordered">
                            <thead>
                                <tr>
                                    <th>商品编号</th>
                                    <th>图片</th>
                                    <th>商品名</th>
                                    <th>单价/数量</th>
                                    <th>商品总额</th>
                                </tr>
                            </thead>
                            <tbody>
                                @foreach (var goods in Model.goods_list)
                                {
                                    <tr>
                                        <td width="10%"><a style="color:seagreen" target="_blank" href="/goods/EditGoods/@goods.goods_id">@goods.goods_id</a></td>
                                        <td width="10%"><img id="img" style="width:80px;height:80px;margin: auto;" /></td>
                                        <td width="30%">@goods.goods_name<br />@goods.json_specs</td>
                                        <td width="10%">￥@goods.goods_price.ToString("0.00") <br />X @goods.goods_quantity</td>
                                        <td width="10%">￥@(goods.goods_price * goods.goods_quantity)</td>
                                    </tr>
                                }
                            </tbody>
                        </table>
                    </div>
                </div>
            </div>
            <div class="col-md-12">
                <!-- general form elements -->
                <div class="box box-primary">
                    <div class="box-header with-border">
                        <h3 class="box-title">支付信息</h3>
                    </div>
                    <!-- /.box-header -->
                    <!-- form start -->
                    <form role="form">
                        <div class="box-body">
                            <div class="col-md-6 form-group">
                                <span>商品总金额:</span>
                                <label>￥@Model.goods_total</label>
                            </div>
                            <div class="col-md-6 form-group">
                                <span>运费:</span>
                                <label>￥@Model.shipping_fee</label>
                            </div>
                            <div class="col-md-6 form-group">
                                <span>支付时间:</span>
                                <label>@(Model.pay_status == null ? "未支付" : "") @Model.pay_time</label>
                            </div>
                            <div class="col-md-6 form-group">
                                <span>优惠金额:</span>
                                <label>￥@Model.discounts</label>
                            </div>
                            <div class="col-md-6 form-group">
                                <span>实付金额:</span>
                                <label>￥@Model.amount</label>
                            </div>
                            <div class="col-md-6 form-group">
                                <span>支付编号:</span>
                                <label>@(Model.pay_no == null ? "未支付" : Model.pay_no)</label>
                            </div>
                        </div>
                        <!-- /.box-body -->
                    </form>
                </div>
                <!-- /.box -->
            </div>
            <div class="col-md-12">
                <!-- general form elements -->
                <div class="box box-primary">
                    <div class="box-header with-border">
                        <h3 class="box-title">配送信息</h3>
                    </div>
                    <!-- /.box-header -->
                    <div class="box-body">
                        <div class="col-md-4 form-group">
                            <span>收货人:</span>
                            <label>@Model.address.accepter_name</label>
                        </div>
                        <div class="col-md-4 form-group">
                            <span>收货电话:</span>
                            <label>@Model.address.mobile</label>
                        </div>
                        <div class="col-md-4 form-group">
                            <span>收货地址:</span>
                            <label>@Model.address.area@Model.address.address</label>
                        </div>
                        <div class="col-md-4 form-group">
                            <span>快递公司:</span>
                            <label>@(Model.shipment_status == "未发货" ? Model.shipment_status : "") @{var company_name = Model.waybill == null ? "" : Model.waybill.company_name; @company_name}</label>
                        </div>
                        <div class="col-md-4 form-group">
                            <span>运单号:</span>
                            <label>@(Model.shipment_status == "未发货" ? Model.shipment_status : "") @{var waybill = Model.waybill == null ? "" : Model.waybill.waybill_no; @waybill}</label>
                        </div>
                        <div class="col-md-4 form-group">
                            <span>发货时间:</span>
                            <label>@(Model.shipment_status == "未发货" ? Model.shipment_status : "") @Model.shipment_time</label>
                        </div>
                    </div>
                    <!-- /.box-body -->
                </div>
                <!-- /.box -->
            </div>
        </div>
    </section>
    @Html.Action("GetLogistics", "Order")
</div>
@section JS{
    <script>
        $(function () {
            @*var img= domain + '@Model.goods.picture_url';
            $("#img").attr("src",img);*@
         });
        function SendShip(order_id) {
            $("#order_id").val(order_id);
        }
        function UpdateLogistics() {
            var logistics = $("#logistics").val();
            var waybill_no = $("#waybill_no").val();
            if (logistics == 0) { alert("请选择物流公司"); return; }
            if (waybill_no.length == 0) { alert("运单号不能为空"); return; }
            $('#UpdateLogistics').submit();
        }
    </script>
}
